package com.demonzym.gtv.view;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;

import com.demonzym.framework.adapter.ArrayListAdapter;
import com.demonzym.gtv.R;
import com.demonzym.gtv.metadata.Channel;

public class ChannelListAdapter extends ArrayListAdapter<Channel> {
	Context mContext;
	LayoutInflater mInflater;
	public ChannelListAdapter(Context context) {
		// TODO Auto-generated constructor stub
		mContext = context;
		mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if(convertView == null){
			convertView = mInflater.inflate(R.layout.view_channel_list_item, null);
			TextView tv = (TextView) convertView.findViewById(R.id.channel_text_item);
			ViewHolder holder = new ViewHolder();
			holder.title = tv;
			convertView.setTag(holder);
		}
		ViewHolder holder = (ViewHolder) convertView.getTag();
		holder.title.setText(getItem(position).getName());
		return convertView;
	}
	
	class ViewHolder{
		TextView title;
	}

}
